package ibm.cognos.imt;

/**
 * Created with IntelliJ IDEA.
 * User: eric
 * Date: 2/26/14
 * Time: 4:14 PM
 * To change this template use File | Settings | File Templates.
 */
public class XmlReportUtil {

//    public String convertToHtmlTable(String reportInXml) throws DocumentException {
//        SAXReader saxReader = new SAXReader();
//        org.dom4j.Document document = saxReader.read(new StringReader(reportInXml));
//        org.dom4j.Element root = document.getRootElement();
//        System.out.println(root);
//        StringBuffer sb = new StringBuffer();
//        sb.append("<table>");
//
//        Iterator data = root.elementIterator();
//        while (data.hasNext()) {
//            sb.append("<tbody>");
//            org.dom4j.Element node = (org.dom4j.Element) data.next();
//            if (node.getName().equals("data")) {
//                Iterator rowIt = node.elementIterator();
//                while (rowIt.hasNext()) {
//                    sb.append("<tr>");
//                    org.dom4j.Element value = (org.dom4j.Element) rowIt.next();
//                    Iterator valueIt = value.elementIterator();
//                    while (valueIt.hasNext()) {
//                        sb.append("<td>");
//                        org.dom4j.Element x = (org.dom4j.Element) valueIt.next();
//                        System.out.println(x.getData());
//                        sb.append(x.getData());
//                        sb.append("</td>");
//                    }
////                    System.out.println(col);
//                    sb.append("</tr>");
//                }
//                sb.append("</tbody>");
//            }
//            if (node.getName().equals("metadata")) {
//                sb.append("<thead>");
//                sb.append("<tr>");
//                Iterator it1 = node.elementIterator();
//                while (it1.hasNext()) {
//                    sb.append("<th>");
//                    org.dom4j.Element element1 = (org.dom4j.Element) it1.next();
//                    sb.append(element1.attributeValue("name"));
//                    sb.append("</th>");
//                    System.out.println(element1.attributeValue("name"));
//                }
//                sb.append("</tr>");
//                sb.append("</thead>");
//            }
//        }
//        sb.append("</table>");
//        return sb.toString();
//    }
}
